import { shapes } from './common';
import NodeDatastructure from './node';
import { getRandomColorKey } from '../utils/colors';

export default class Shape extends NodeDatastructure {
  constructor(type, { width, height, x, y }) {
    super();
    this.type = type;
    this.width = width;
    this.height = height;
    this.x = x;
    this.y = y;

    let colorKey = '';
    while(true) {
      colorKey = getRandomColorKey();
      if (colorKey && !(colorKey in shapes)) {
        break;
      }
    }
    this.colorKey = key;
    shapes[colorKey] = this;
  }
  setWidth(width) {
    this.width = width;
  }
  getWidth() {
    return this.width;
  }
  setHeight(height) {
    this.height = height;
  }
  getHeight() {
    return this.height;
  }
  setX() {
    this.x = x;
  }
  getX() {
    return this.x;
  }
  setY() {
    this.y = y;
  }
  getY() {
    return this.y;
  }
  draw() {
    
  }
}